package com.ruoyi.image.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.image.domain.AcupointImage;
import com.ruoyi.image.service.IAcupointImageService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 全身穴位图片主Controller
 * 
 * @author ruoyi
 * @date 2025-10-10
 */
@RestController
@RequestMapping("/image")
public class AcupointImageController extends BaseController
{
    @Autowired
    private IAcupointImageService acupointImageService;

    /**
     * 查询全身穴位图片主列表
     */
    @RequiresPermissions("image:image:list")
    @GetMapping("/list")
    public TableDataInfo list(AcupointImage acupointImage)
    {
        startPage();
        List<AcupointImage> list = acupointImageService.selectAcupointImageList(acupointImage);
        return getDataTable(list);
    }

    /**
     * 导出全身穴位图片主列表
     */
    @RequiresPermissions("image:image:export")
    @Log(title = "全身穴位图片主", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AcupointImage acupointImage)
    {
        List<AcupointImage> list = acupointImageService.selectAcupointImageList(acupointImage);
        ExcelUtil<AcupointImage> util = new ExcelUtil<AcupointImage>(AcupointImage.class);
        util.exportExcel(response, list, "全身穴位图片主数据");
    }

    /**
     * 获取全身穴位图片主详细信息
     */
    @RequiresPermissions("image:image:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(acupointImageService.selectAcupointImageById(id));
    }

    /**
     * 新增全身穴位图片主
     */
    @RequiresPermissions("image:image:add")
    @Log(title = "全身穴位图片主", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AcupointImage acupointImage)
    {
        return toAjax(acupointImageService.insertAcupointImage(acupointImage));
    }

    /**
     * 修改全身穴位图片主
     */
    @RequiresPermissions("image:image:edit")
    @Log(title = "全身穴位图片主", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AcupointImage acupointImage)
    {
        return toAjax(acupointImageService.updateAcupointImage(acupointImage));
    }

    /**
     * 删除全身穴位图片主
     */
    @RequiresPermissions("image:image:remove")
    @Log(title = "全身穴位图片主", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(acupointImageService.deleteAcupointImageByIds(ids));
    }
}
